package algorithm;

/**
 * @author Panbo Guo
 * @date 2021/7/14
 */
public class T00104 {

    public static void main(String[] args) {
        Integer[] arr = new Integer[]{3,9,20,null,null,15,7};
        TreeNode treeNode = TreeUtils.buildTree(arr);
        System.out.println(new Solution().maxDepth(treeNode));
    }

    static class Solution {
        public int maxDepth(TreeNode root) {
            return root == null ? 0 : Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
        }
    }
}
